import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
Vue.prototype.$store = store

const store = new Vuex.Store({
  state: {
    lang: 'En',
    baseSrc: '/static/image/',
    footToHome: 0,
    scrollTop: 0,
    clientHeight: 0,
    innerWidth: 0,
    forumTypes: [],
    searchListBoolean: false,
    successNum: 0,
    banners: {},
    openAd: false,
    labels: []
  },
  mutations: {
    setLang (state, v) {
      state.lang = v
    },
    setFootToHome (state) {
      state.footToHome += 1
    },
    setTop(state, v) {
      state.scrollTop = v
    },
    setHeight(state, v) {
      state.clientHeight = v
    },
    setWidth(state, v) {
      state.innerWidth = v
    },
    setForumType(state, v) {
      state.forumTypes = v
    },
    setSearchList(state, v) {
      state.searchListBoolean = v
    },
    setSuccessNum(state) {
      state.successNum++
    },
    clearSuccessNum(state) {
      state.successNum = 0
    },
    setBanners(state, v) {
      state.banners = v
    },
    setOpenAd(state, v) {
      state.openAd = v
    },
    setLabels(state, v) {
      state.labels = v
    }
  }
})

export default store